package com.delayqueue.common.util;

import com.delayqueue.common.netty.NettyMessage;
import io.netty.channel.ChannelHandlerContext;
import lombok.extern.slf4j.Slf4j;


@Slf4j
public class NettyMessageUtil {

    public static void send(ChannelHandlerContext channelHandlerContext, NettyMessage nettyMessage) {
        if (channelHandlerContext != null && channelHandlerContext.channel().isActive()) {
            channelHandlerContext.channel().writeAndFlush(nettyMessage);
        } else {
            log.info("channel未连接");
        }
    }
}
